package com.itheima.mybatis.web;

import com.itheima.mybatis.pojo.Emp;
import com.itheima.mybatis.pojo.Result;
import com.itheima.mybatis.service.EmpService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class EmpController {
    //使用service实例

//    @Autowired  //按照bean类型注入
//    @Qualifier("empServiceA")
    @Resource(name = "empServiceA")
    private EmpService empService;

    /**
     * 获取员工列表
     * @return
     */
    @RequestMapping("/listEmp")
    public Result list(){
        //获取处理后的员工列表数据
        List<Emp> empList = empService.listEmp();



        // 响应员工列表数据
        return Result.success(empList);
    }
}